package online.shenme.day07.test02;

import java.util.ArrayList;
import java.util.Collection;

public class Entry implements IDataOperation<Student> {
    ArrayList<Student> stu = new ArrayList<>();

    public static void main(String[] args) {

    }


    @Override
    public boolean add(Student t) {
        if (!stu.contains(t)) {
            stu.add(t);
            return true;
        }
        return false;
    }

    @Override
    public <T> boolean delete(T t) {
        return stu.contains(t) && stu.remove(t);
    }

    @Override
    public <T> boolean update(Student student) {
        boolean flag=false;
        for (int i = 0; i < stu.size(); i++) {
            if (student.getId().equals(stu.get(i).getId())) {
                stu.set(i,student);
                flag= true;
                break;
            }
        }
        return flag;
    }

    @Override
    public <T> Student get(T t) {
        return null;
    }

    @Override
    public Collection<Student> getAll() {
        return null;
    }

}
